package com.qfedu.knowledge.controller;

import com.qfedu.knowledge.entity.bo.RoleBO;
import com.qfedu.knowledge.entity.vo.ResultVO;
import com.qfedu.knowledge.service.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName RoleController
 * @Author ykx
 * @Date 2024/4/27 7:06
 * @Version 1.0
 */
@RestController
@RequestMapping("/knowledge/roles")
public class RoleController {

    @Autowired
    private IRoleService roleService;

    @GetMapping("/list")
    public ResultVO getRoleList() {
        return ResultVO.success(roleService.getRoleList());
    }

    @PutMapping("/{id}")
    public ResultVO updateRole(@PathVariable Long id, @RequestBody RoleBO roleBO) {
        roleBO.setId(id);
        return ResultVO.success(roleService.updateById(roleBO));
    }

}
